#include "dotrever.h"

static void
rever(char * p, char * q)
{
	while (p < q) {
		char temp = *p;
		*p++ = *q;
		*q-- = temp;
	}
}

int
dot_rever(char * data, size_t len)
{

	char * p = data;
	char * q = p;
	char * e = data + len;

	for (; p < e; q = ++p) {
		for (; *p != '.' && p < e; ++p) {}
		rever(q, p - 1);
	}

	rever(data, e - 1);

	return 0;
}

